home *** CD-ROM | disk | FTP | other *** search
- Path: seaeagle.csi.cam.ac.uk!ag129
- From: ag129@ucs.cam.ac.uk (A. Grant)
- Newsgroups: comp.lang.pl1,comp.lang.c
- Subject: Re: PL/I and C
- Date: Wed, 28 Feb 1996 11:37:33
- Organization: University of Cambridge
- Message-ID: <ag129.154.000BA099@ucs.cam.ac.uk>
- References: <4gh5ru$eng@goanna.cs.rmit.EDU.AU> <4grhtv$s31@goanna.cs.rmit.EDU.AU> <4gt0tv$826@solutions.solon.com> <4gv8h0$3o2k@news-s01.ny.us.ibm.net> <4h066c$r0t@solutions.solon.com>
- NNTP-Posting-Host: seaeagle.csi.cam.ac.uk
-
- In article <4h066c$r0t@solutions.solon.com> seebs@solutions.solon.com (Peter Seebach) writes:
- >Are you telling me PL/I can't have a non-fixed length string, dynamically
- >allocated? If it can, the compare or copy functionality will do the same
- >thing strcmp() and strcpy() do at some level. If it can't, it sucks.
-
- Actually it won't, since in PL/I the length field is held separately.
- It does not have to scan through a string to find its length.
- Functions become constant-time rather than linear and many "running
- off the end" errors are avoided.
-
- Basically the C str...() functions are provided for students and
- systems programmers. Anyone doing serious amounts of string handling
- in C/C++ defines a string abstract type, or class or whatever, with the
- length field held separately. Have a look at the implementation of
- strings in the C source of languages like Perl, Icon and Rexx.
-